package com.gopay.common.constants.bank;

/**
 * 银行所属机构标示枚举
 * @ClassName: BankOfAffiliationConstants
 * @author w_jiqing
 * @date 2017年7月14日 上午10:51:25  
 */
public enum BankOfAffiliationConstants {
    /** 测试银行*/
    TBANK(BankConstants.BANK_LOGO_TBANK,"C1010611003601"),

    /** 工商银行*/
    ICBC (BankConstants.BANK_LOGO_ICBC,"C1010211000012"),
//    ICBC (BankConstants.BANK_LOGO_ICBC,"C1010611003601"),
    /** 农业银行*/
    ABC(BankConstants.BANK_LOGO_ABC,"C1010311000014"),
    /** 中国银行*/
    BOC(BankConstants.BANK_LOGO_BOC,"C1010411000013"),
    /** 建设银行*/
    CCB(BankConstants.BANK_LOGO_CCB,"C1010511003703"),
    /** 交通银行*/
    //真实银行
    BOCOM(BankConstants.BANK_LOGO_BOCOM,"C1030131001288"),
    //联调测试银行
    //BOCOM(BankConstants.BANK_LOGO_BOCOM,"C1010611003601"),
    /** 招商银行*/
    CMB(BankConstants.BANK_LOGO_CMB,"C1030844001362"),
    /** 邮储银行*/
    PSBC(BankConstants.BANK_LOGO_PSBC,"C1040311005293"),
    /** 中信银行*/
    CITIC(BankConstants.BANK_LOGO_CITIC,"C1030211000389"),
    /** 平安银行*/
    PAB(BankConstants.BANK_LOGO_PAB,"C1030744001296"),
    /** 华夏银行*/
    HXBC(BankConstants.BANK_LOGO_HXBC,"C1030411000431"),
    /** 光大银行*/
    CEB(BankConstants.BANK_LOGO_CEB,"C1030311000455"),
    /** 兴业银行*/
    CIB(BankConstants.BANK_LOGO_CIB,"C1030935001347"),
    /** 民生银行*/
    CMBC(BankConstants.BANK_LOGO_CMBC,"C1030511000483"),
    /** 浦发银行*/
    SPDB(BankConstants.BANK_LOGO_SPDB,"C1031031001312"),
    /** 湖州银行*/
    HZCCB(BankConstants.BANK_LOGO_HZCCB,"C1092433000021");

    public final String key;
    public final String value;

    private BankOfAffiliationConstants(String key,String value) {
        this.key =key;
        this.value = value;
    }

    @Override
    public String toString() {
        return this.value;
    }

    public static String getAffiliation(String key){
        BankOfAffiliationConstants[] cs = BankOfAffiliationConstants.class.getEnumConstants();
        for(BankOfAffiliationConstants c: cs){
            if(c.getKey().equals(key)){
                return c.value;
            }
        }
        throw new RuntimeException(" wrong " + BankOfAffiliationConstants.class.getSimpleName() + " string key! bank=" + key);
    }

    public static String getBankCode(String value){
        BankOfAffiliationConstants[] cs = BankOfAffiliationConstants.class.getEnumConstants();
        for(BankOfAffiliationConstants c: cs){
            if(c.getValue().equals(value)){
                return c.key;
            }
        }
        throw new RuntimeException(" wrong " + BankOfAffiliationConstants.class.getSimpleName() + " string value! affiliation=" + value);

    }

    public String getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }
}
